﻿using UnityEngine;
using System.Collections;

public class moveLift : MonoBehaviour {
	
	Vector3 currentPosition;
//public Vector3 moveDirection; //For example
 public Vector3 targetPosition;
public float speed;
float t;
bool destroyMe;
	// Use this for initialization
	void Start () {
		//currentPosition = transform.position;
       t = 2;
	
	}
	
	// Update is called once per frame
	void Update () {
		
		 t = Mathf.Clamp01(Time.deltaTime + t);
      // transform.position = currentPosition + (moveDirection * t);
      transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * speed);
//      Debug.Log(transform.position + "" + targetPosition); 
 		if(transform.position == targetPosition && destroyMe){
 		//Destroy(this);
// 		Debug.Log("dead");
	
	}
	}
}
